View Javadoc

1   // Float.java, created Thu Jul  4  4:50:03 2002 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.ClassLib.Common.java.lang;
5   
6   import joeq.Runtime.Unsafe;
7   
8   /***
9    * Float
10   *
11   * @author  John Whaley <jwhaley@alum.mit.edu>
12   * @version $Id: Float.java 1456 2004-03-09 22:01:46Z jwhaley $
13   */
14  abstract class Float {
15      
16      // native method implementations.
17      public static int floatToIntBits(float value) {
18          if (java.lang.Float.isNaN(value)) return 0x7fc00000;
19          return Unsafe.floatToIntBits(value);
20      }
21      public static int floatToRawIntBits(float value) {
22          return Unsafe.floatToIntBits(value);
23      }
24      public static float intBitsToFloat(int bits) {
25          return Unsafe.intBitsToFloat(bits);
26      }
27  
28  }